package com.lyl.syt.task;

import cn.hutool.core.date.DateUtil;
import com.lyl.syt.rabbit.constant.MqConstant;
import com.lyl.syt.rabbit.service.RabbitService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Mr.Luo
 * @date 2022-05-27 11:02
 * @desc 定时任务
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class ScheduleTask {
    private final RabbitService rabbitService;

    /**
     * 定时任务：每天八点提醒就医
     */
    @Scheduled(cron = "0 0 8 * * ?")
    public void remindToSeeADoctorTask(){
        log.info("发送就医提醒定时任务开始执行 {}", DateUtil.now());
        rabbitService.sendMessage(MqConstant.TASK_EXCHANGE,MqConstant.TASK_ROUTING,"");
    }

}
